package com.qst.yunpan.service;



import com.qst.yunpan.entity.FileCustom;
import com.qst.yunpan.entity.RecycleFile;
import com.qst.yunpan.entity.SummaryFile;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;

public interface FileService {
    //新用户注册，初始化四个文件夹
    void addNewNameSpace( HttpServletRequest request,String namespace);

    //获取文件路径
    String getFilePath(HttpServletRequest request,String fileName);
    String getFilePath(HttpServletRequest request,String currentPath,String fileName);

    //文件夹/文件显示
    List<FileCustom> listFile(String realPath);

    //上传文件
    void uploadFilePath(HttpServletRequest request, MultipartFile[] files,String currentPath)throws Exception;

    //下载文件（打包成压缩包，下载多个文件）
    public File downPackage(HttpServletRequest request, String currentPath, String[] fileNames, String username) throws Exception;

    //删除压缩包
    void deleteDownPackage(File downloadFile);

    //文件分类,文件查找
    public List<FileCustom> searchFile (HttpServletRequest request,String currentPath,String reg,String regType);

    //打开图片/文本文件
    void respFile(HttpServletResponse response, HttpServletRequest request, String currentPath, String fileName, String type) throws IOException;

    //打开office文档
    String openOffice(HttpServletRequest request, String currentPath, String fileName) throws Exception;

    //添加文件夹
    public boolean addDirectory(HttpServletRequest request,String currentPath,String directoryName);

    //删除文件夹/文件
    public void delDirectory(HttpServletRequest request, String currentPath, String[] directoryName) throws Exception;

//    //删除文件文件夹
//    public void delFile(File srcFile) throws Exception;

    //修改文件夹
    public boolean renameDirectory(HttpServletRequest request, String currentPath, String srcName, String destName);

    //于获取该用户的所有目录结构并返回前台
    public SummaryFile summarylistFile(String realPath, int number);

    //复制文件目录
    public void copyDirectory(HttpServletRequest request,String currentPath,String[] directoryName,String targetdirectorypath) throws Exception;

    //复制文件
    public void copyfile(File srcFile,File targetFile) throws IOException;

    //移动文件/文件夹
    public void moveDirectory(HttpServletRequest request, String currentPath, String[] directoryName, String targetdirectorypath) throws Exception;

    //访问数据库，查询回收站的数据
    public List<RecycleFile> recycleFiles(HttpServletRequest request) throws Exception;

    //还原删除的文件文件夹
    public void revertDirectory(HttpServletRequest request,int[] fileId) throws Exception;

    //清空回收站
    public void delAllRecycle(HttpServletRequest request) throws Exception;

    //删除回收站单个文件
    public void delRecycle(HttpServletRequest request,int fileId) throws  Exception;
}
